﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Net; 
using System.Net.Sockets; 

using Lextm.SharpSnmpLib.Messaging;
using Snmp.Agent.DataLoader;
using SnmpWorkshop.Tools;
using SnmpWorkshop.Communication;
using SnmpWorkshop.SnmpAgent;

namespace SnmpWorkshop.SnmpConsole
{
  class Program 
  {
    static void Main( string[] _args )
    {
      if( _args.Length!= 1)
      {
        Console.WriteLine( "usage: snmp.console <port>");
        return;
      }

      UdpSkeleton udpSkeleton= new UdpSkeleton();
      udpSkeleton.Configure( _args);

      SnmpWorkshop.SnmpAgent.SnmpAgent snmpAgent= new SnmpWorkshop.SnmpAgent.SnmpAgent();
      snmpAgent.Configure();
 
      udpSkeleton.OnMessageIn+= new UdpSkeleton.OnUdpMessageInHandler( snmpAgent.OnUdpMessageInHandler); 
      snmpAgent.OnUdpMessageOut+= new SnmpAgentBase.OnUdpMessageOutHandler( udpSkeleton.OnUdpMessageOutHandler);

      udpSkeleton.Run();
    }
  }
}
